<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="format-detection" content="telephone=no">
    #parse("/h5/common/webWords.html")
<link rel="stylesheet" type="text/css" href="http://${staticHost}/css/medioadaption.css">
<link rel="stylesheet" type="text/css" href="http://${staticHost}/css/stcss.css">
<!--<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.css">-->
<script type="text/javascript" src="http://${staticHost}/js/jquery.js"></script>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <script src="http://${staticHost}/js/layer.js"></script>

    <script type="text/javascript">
        function showMessage(msg){
            layer.open({
                content: msg
                ,btn: '关闭'
            });
        }
	$(document).ready(function(){
		getCode();
	});
	
	function sendSMS(){
		
        var uuid = $("#uuid").val();
        var imgCode = $("#imgCode").val();
        var mobilePhone = $("#mobilePhone").val();
        
        if(mobilePhone == ''){
        	showMessage('请输入注册手机号码');
        	return;
        }
        
        if(imgCode == ''){
        	showMessage('请输入图片验证码');
        	return;
        }
        
        $.ajax({
            type:'post',
            url:'/edu/public/sendSms',
            contentType:'application/x-www-form-urlencoded; charset=utf-8',
            data:{
            	uuid:uuid,
            	imgCode:imgCode,
            	mobilePhone:mobilePhone
            },
            success: function (result) {
                if(result.status == '00000000'){
                    showMessage("短信验证码发送成功!");
                }else{
                	changeCode();
                	showMessage(result.message);
                }
            }
        });
  	}
	
	function backPassWord(){
		
		var newPwd = $("#newPwd").val();
		var smsCode = $("#smsCode").val();
        var confirmPwd = $("#confirmPwd").val();
        var mobilePhone = $("#mobilePhone").val();

        if(smsCode == ''){
        	showMessage('请输入短信验证码');
        	return;
        }
        
        if(mobilePhone == ''){
        	showMessage('请输入注册手机号');
        	return;
        }
        
        if(newPwd == ''){
        	showMessage('请输入新密码');
        	return;
        }
        
        if(confirmPwd == ''){
        	showMessage('请输入确认新密码');
        	return;
        }
        
        if(confirmPwd != newPwd){
        	showMessage('两次输入的密码不一致');
        	return;
        }
        
        $.ajax({
            type:'post',
            url:'/edu/public/backPassWord',
            contentType:'application/x-www-form-urlencoded; charset=utf-8',
            data:{
            	newPwd:newPwd,
            	smsCode:smsCode,
            	confirmPwd:confirmPwd,
            	mobilePhone:mobilePhone
            },
            success: function (result) {
                if(result.status == '00000000'){
                    showMessage("密码修改成功!");
                    window.location.href='/edu/public/toLogin';
                }else{
                	changeCode();
                	showMessage(result.message);
                }
            }
        });
  	}
	
	function changeCode(){
 	   getCode();
    }
	
	function getCode(){
  		$.ajax({
              url:"/public/api/ImgCode",
              type:"POST", 
              error:function(xmlHttpRequest, error) { // 设置表单提交出错
              	console.log(error);
              },
              success:function(data) {
              	   var uuid=data.uuid;
                  var imgStr=data.imgStr;
                  var src = "data:image/jpeg;base64,"+imgStr;	
                  $("#code").attr("src",src);
                  $("#uuid").val(uuid);
              }
          });
  	}
		
</script>

</head>


<body style="background-color:#f8f8f8;">
<div class="md_zcbg"><img src="http://${staticHost}/images/grzcbg.jpg"></div>
<div class="dlmain">
   <dl>
      <dt>手机号*：</dt>
      <dd>
          <input type="text" name="mobilePhone" id="mobilePhone" class="wb70" value="" ><div style="color:#dc5c5c" id="phoneNumberDiv"></div>
      </dd>  
   </dl>
   <dl>
   		<dt>图片验证码*：</dt>
   	    <input type="hidden" name="uuid" id="uuid" value="" />
   	    <dd>
          <input type="text" name="imgCode" id="imgCode" style="width: 50%;" class="wb70" value="" ><div style="color:#dc5c5c" id="imgCode"></div>
       </dd>  
   </dl>
   <img id="code" src="" onclick="changeCode()" style="width: 27%;margin-top:  -9%;margin-left: 65%;"/>
   <dl>
      <dt>短信验证码*：</dt>
      <dd>
          <input type="text" name="smsCode" id="smsCode" style="width: 50%;" class="wb70" value="" ><div style="color:#dc5c5c" id="imgCode"></div>
      	  <a class="btn btn-info" onclick="sendSMS()" style="margin-top: -15%;float: left;display: block;line-height: 58px;margin-left: 65%;width: 27%;background: rgb(73, 185, 234);color: white;height: 45px;margin-bottom: 20px;text-align: center;"  >短信验证码</a>
      </dd>  
   </dl>
      <!--<button class="btn btn-info smsBtn" onclick="sendSMS()" >短信验证码</button>-->
   <dl style="margin-top: -2%;">
      <dt>输入新密码*：</dt>
      <dd>
          <input type="password" name="newPwd" id="newPwd" class="wb70" value="" ><div style="color:#dc5c5c" id="phoneNumberDiv"></div>
      </dd>  
   </dl>
   <dl>
      <dt>确认新密码*：</dt>
      <dd>
          <input type="password" name="confirmPwd" id="confirmPwd" class="wb70" value="" ><div style="color:#dc5c5c" id="phoneNumberDiv"></div>
      </dd>  
   </dl>
   <dl style="text-align:center;">
      <input name="" type="image" onclick="backPassWord()" id="backPwdSubmit" src="http://${staticHost}/images/tj01.jpg" style="width:290px; height:42px; border:none;" />
   </dl>
</div>
</body>
</html>